<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\grid\GridView;
use common\models\Course;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '报名管理';
$this->params['breadcrumbs'][] = $this->title;
$course = Course::find()->select(['id', 'title'])->asArray()->all();
$course = ArrayHelper::index($course, 'id');
?>
<div class="box">
    <div class="box-body">

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            [
                'attribute' => 'cid',
                'value' => function ($model) use ($course) {
                    return $course[$model->cid]['title'];
                }
            ],
            'name',
            'tel',
            //'addr',
            'created_at:datetime',
            //'updated_at',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
</div>
</div>
